/**
 * Created by mooshroom on 2015/5/19 0019.
 */
define('home',[
    'avalon',
    'list'
],function(){
    var vm=avalon.define({
        $id:"home",
        ready:function(type){
            console.log("home加载完成")
            home.getClass()
            vm.active=type

        },
        reset: function () {
            vm.active=''
        },

        //获取栏目
        navLeft:[],
        getClass:function(){
            $.call({
                type:'post',
                i:'CMS_GetArticleClass',
                data:{
                    ClassID:'All',
                    Page:1,
                    PageNumber:9999999
                },
                success:function(res){
                     if(res.c==200){
                         console.log('栏目获取成功')
                         home.navLeft=res.d.List
                     }
                    else{
                         console.log(res.c+":"+res.m)
                     }
                }

            })
        },

        //分类导航事件
        toClass:function(id){
            list.List=[]
            list.Get({
                ClassID:id
            })
        },

        //导航高亮
        active:"",


    })
    return window.home=vm
})